import request from '@/utils/request'

const api = {
  getDeptListUrl: '/base_dept/get_dept_list',
  getDeptTreeUrl: '/base_dept/get_dept_tree',
  addDeptUrl: '/base_dept/add_dept',
  updateDeptUrl: '/base_dept/update_dept',
  removeDeptUrl: '/base_dept/remove_dept',
}

export async function removeDeptApi(params: Map<string, any>) {
  const res = await request({
    url: api.removeDeptUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function updateDeptApi(params: Map<string, any>) {
  const res = await request({
    url: api.updateDeptUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function addDeptApi(params: Map<string, any>) {
  const res = await request({
    url: api.addDeptUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getDeptListApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDeptListUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getDeptTreeApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDeptTreeUrl,
    method: 'get',
    params: params,
  })
  return res
}
